// 预加载
$(document).ready(function() {
    layui.use(['form','laydate'], function() {
        var form = layui.form
            ,laydate = layui.laydate

        //日期
        laydate.render({
            elem: '#date3',
            format: 'yyyyMMdd'
        });
        form.on('submit(demo1)',function(data){
            $.ajax({
                type: "post",
                url: "/setmeal/addSetmealInfo",
                dataType: "json",
                traditional: true,
                contentType : 'application/json;charset=utf-8',
                data:
                    JSON.stringify({
                        setmName: $('#setmName').val(),
                        tc001: $('#tc001').val(),
                        xlc001: $('#xlc001').val(),
                        oriPrice: $('#oriPrice').val(),
                        actPrice: $('#actPrice').val(),
                        setmDescribe: $('#setmDescribe').val(),
                        expireTime: $('#date3').val()
                    }),
                success: function(res) {
                    console.log("添加成功");
                    layui.use('layer', function(){
                        var layer = layui.layer;
                        layer.msg('添加成功');
                        $('#setmName').val(''),
                        $('#tc001').val(''),
                        $('#xlc001').val(''),
                        $('#oriPrice').val(''),
                        $('#actPrice').val(''),
                        $('#setmDescribe').val(''),
                        $('#date3').val('')
                    })
                }
            })
        })
    })
})